import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useHistoryStore = defineStore(
  'music-history',
  () => {
    const history = ref([])
    const setHistory = (arr) => {
      history.value = arr
    }
    const getHistory = () => {
      return history.value.length > 0 ? history.value : []
    }
    return {
      history,
      setHistory,
      getHistory
    }
  },
  {
    persist: true // 持久化
  }
)
